home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ttedit / 3d.bas next >
BASIC Source File  |  1994-11-28  |  4KB  |  113 lines

  1. Option Explicit
  2.  
  3. Const COLOR_WHITE = &HFFFFFF
  4. Const COLOR_DARKGREY = &H808080
  5.  
  6. '
  7. ' Assume the Scalemode of the form is PIXEL
  8. '
  9. Sub Frame (fTop As Integer, fLeft As Integer, fHeight As Integer, fWidth As Integer, fCaption As Control)
  10.     Dim fBottom As Integer
  11.     Dim fRight As Integer
  12.     Dim F As Form
  13.     Set F = fCaption.Parent
  14.     fBottom = fTop + fHeight
  15.     fRight = fLeft + fWidth
  16.     F.Line (fLeft + 1, fTop + 1)-(fRight, fBottom), COLOR_WHITE, B
  17.     F.Line (fLeft, fTop)-(fRight - 1, fBottom - 1), COLOR_DARKGREY, B
  18.     F.Line (fLeft, fBottom)-(fRight, fBottom), COLOR_WHITE
  19.     F.Line (fRight, fTop)-(fRight, fBottom), COLOR_WHITE
  20.     fCaption.ZOrder
  21. End Sub
  22.  
  23. '
  24. ' Inset a control on a form
  25. '
  26. Sub Indent (C As Control)
  27.     Dim SM As Integer
  28.     Dim F As Form
  29.     Set F = C.Parent
  30.     SM = F.ScaleMode
  31.     F.ScaleMode = 3
  32.     F.Line (C.Left - 1, C.Top - 1)-(C.Left - 1, C.Top + C.Height + 1), COLOR_DARKGREY
  33.     F.Line (C.Left + C.Width + 1, C.Top - 1)-(C.Left - 1, C.Top - 1), COLOR_DARKGREY
  34.     F.Line (C.Left + C.Width + 1, C.Top - 1)-(C.Left + C.Width + 1, C.Top + C.Height + 1), COLOR_WHITE
  35.     F.Line (C.Left - 1, C.Top + C.Height + 1)-(C.Left + C.Width + 1, C.Top + C.Height + 1), COLOR_WHITE
  36.     F.ScaleMode = SM
  37. End Sub
  38.  
  39. '
  40. ' Use this where the Control "C" is contained within "Container"
  41. '
  42. Sub IndentControl (C As Control, Container As Control)
  43.     Container.Line (C.Left - 1, C.Top - 1)-(C.Left - 1, C.Top + C.Height + 1), COLOR_DARKGREY
  44.     Container.Line (C.Left + C.Width + 1, C.Top - 1)-(C.Left - 1, C.Top - 1), COLOR_DARKGREY
  45.     Container.Line (C.Left + C.Width + 1, C.Top - 1)-(C.Left + C.Width + 1, C.Top + C.Height + 1), COLOR_WHITE
  46.     Container.Line (C.Left - 1, C.Top + C.Height + 1)-(C.Left + C.Width + 1, C.Top + C.Height + 1), COLOR_WHITE
  47. End Sub
  48.  
  49. Sub IndentLabel (C As Control, Parent As Integer)
  50.     Dim X As Integer
  51.     Dim F As Form
  52.     Dim PB As Control   ' Probably a PictureBox
  53.     Dim Is_A_Form As Integer
  54.     If C.Parent.hWnd = Parent Then Is_A_Form = True
  55.     C.BorderStyle = 0
  56.     Set F = C.Parent
  57.     If Is_A_Form Then
  58.        F.Line (C.Left - 1, C.Top - 1)-(C.Left - 1, C.Top - 1 + C.Height), COLOR_DARKGREY
  59.        F.Line (C.Left + C.Width + 1, C.Top - 1)-(C.Left - 1, C.Top - 1), COLOR_DARKGREY
  60.        F.Line (C.Left + C.Width + 1, C.Top - 1)-(C.Left + C.Width + 1, C.Top - 1 + C.Height), COLOR_WHITE
  61.        F.Line (C.Left - 1, C.Top - 1 + C.Height)-(C.Left + C.Width + 1, C.Top - 1 + C.Height), COLOR_WHITE
  62.     Else
  63.        On Local Error Resume Next ' Controls may not have a hwnd property
  64.        For X = 0 To F.Controls.Count - 1
  65.          If F.Controls(X).hWnd = Parent Then
  66.            Set PB = F.Controls(X)
  67.            Exit For
  68.          End If
  69.        Next
  70.        PB.Line (C.Left - 1, C.Top)-(C.Left - 1, C.Top + C.Height + 1), COLOR_DARKGREY
  71.        PB.Line (C.Left + C.Width + 1, C.Top)-(C.Left - 1, C.Top), COLOR_DARKGREY
  72.        PB.Line (C.Left + C.Width + 1, C.Top)-(C.Left + C.Width + 1, C.Top + C.Height + 1), COLOR_WHITE
  73.        PB.Line (C.Left - 1, C.Top + C.Height + 1)-(C.Left + C.Width + 1, C.Top + C.Height + 1), COLOR_WHITE
  74.     End If
  75. End Sub
  76.  
  77. '
  78. ' Give the statusbar a 3d look
  79. '
  80. Sub RaiseBar (P As PictureBox)
  81.     If P.Align = 1 Then P.Line (0, 0)-(P.ScaleWidth - 1, P.ScaleHeight - 1), 0&, B
  82.     P.Line (1, P.ScaleHeight - 2)-(P.ScaleWidth - 1, P.ScaleHeight - 2), COLOR_DARKGREY, B
  83.     P.Line (1, 0)-(P.ScaleWidth - 1, 0), COLOR_WHITE
  84.     P.Line (1, 1)-(1, P.ScaleHeight - 1), COLOR_WHITE
  85. End Sub
  86.  
  87. '
  88. ' Give a form a 3d look
  89. '
  90. Sub Raiseform (F As Form)
  91.     Dim SM As Integer
  92.     Dim SH As Single
  93.     Dim SW As Single
  94.     Dim X As Integer
  95.     Dim y As Integer
  96.     SM = F.ScaleMode
  97.     F.ScaleMode = 3
  98.     SW = F.ScaleWidth
  99.     SH = F.ScaleHeight
  100.     If F.BorderStyle Then
  101.        F.Line (X, y)-(SW - 1, SH - 1), COLOR_DARKGREY, B
  102.     Else
  103.        F.Line (0, 0)-(SW - 1, SH - 1), 0&, B
  104.        X = 1
  105.        y = 1
  106.        F.Line (X, y)-(SW - 2, SH - 2), COLOR_DARKGREY, B
  107.     End If
  108.     F.Line (X, y)-(SW - 1, y), COLOR_WHITE
  109.     F.Line (X, y)-(X, SH - 1), COLOR_WHITE
  110.     F.ScaleMode = SM
  111. End Sub
  112.  
  113.